<?php /* Smarty version 2.6.18, created on 2010-03-16 09:24:42
         compiled from podetails.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'cycle', 'podetails.tpl', 22, false),array('modifier', 'number_format', 'podetails.tpl', 42, false),)), $this); ?>
 <div id="blanket" style="display:none;"></div>
<div id="reason" style="position:absolute;background-color:#fff;width:400px;z-index: 1002;display:none;"></div>
<div id="divfisherman" style="position:absolute;background-color:#fff;width:500px;z-index: 1002;display:none;"></div>
 <table border="0"	width="100%">
					<tr class="notify">
						<td>MOID</td>
						<td>Common Name</td>
						<td>Size</td>
						<td>Batch No.</td>
						<td>Received</td>
						<td>DOA</td>
						<td>Reject</td>
						<td>Reason</td>
						<td>Tank</td>
						<td>No. of Purchased</td>
						<td>Cost</td>
						<td>Total Cost</td>
					</tr>
					<tr><td colspan="14"><hr></td></tr>
					<?php if ($this->_tpl_vars['podetails']): ?> 
					<?php $_from = $this->_tpl_vars['podetails']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['podetail']):
?>
					<tr id="detail" class="<?php echo smarty_function_cycle(array('values' => "blue,notify"), $this);?>
">
						<td><?php echo $this->_tpl_vars['podetail']['moid']; ?>
</td>
						<td><i><?php echo $this->_tpl_vars['podetail']['scientific_name']; ?>
</i><br><?php if ($this->_tpl_vars['user_type'] == 'Exporter'): ?><a href="javascript:void(0);" onclick="openFisherman('<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
');"><?php echo $this->_tpl_vars['podetail']['name']; ?>
</a><?php else: ?><?php echo $this->_tpl_vars['podetail']['name']; ?>
<?php endif; ?></td>
						<td><?php echo $this->_tpl_vars['podetail']['size']; ?>
</td>
						<td><?php echo $this->_tpl_vars['podetail']['batachno']; ?>
</td>
						<input type="hidden" id="origvalue[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]" value="<?php echo $this->_tpl_vars['podetail']['balance']; ?>
">
						<td align="right" style="padding-right:10px"><input style="width:25px" type="text" value="<?php echo $this->_tpl_vars['podetail']['balance']; ?>
" name="received[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]" id="received[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]"></td>
						<td><input style="width:25px" type="text" name="doa[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]" id="doa[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]"></td>
						<td><input style="width:25px" type="text" name="reject[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]" id="reject[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]" id="reject[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]"> 
						<input type="hidden" name="reasonqty[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]" value="" id="reasonqty[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]">
						</td>
						
						<td><input type="button" value="REASON" onclick="openReason('<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
')" id="btnreason[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]"></td>
						<input type="hidden" value="0" id="fisherman[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]" name="fisherman[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]">
						<td><select name="tank[<?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
]">
							<?php $_from = $this->_tpl_vars['tanklists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['tank']):
?>
								<option value="<?php echo $this->_tpl_vars['tank']['tank_id']; ?>
"><?php echo $this->_tpl_vars['tank']['name']; ?>
</option>
							<?php endforeach; endif; unset($_from); ?>
						</select></td>
						<td align="right"><?php echo $this->_tpl_vars['podetail']['order_quantity']; ?>
</td>
						<td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['podetail']['order_amount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, "2%d") : number_format($_tmp, "2%d")); ?>
</td>
						<?php $this->assign('cost', $this->_tpl_vars['podetail']['order_quantity']*$this->_tpl_vars['podetail']['order_amount']); ?>
						<td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['cost'])) ? $this->_run_mod_handler('number_format', true, $_tmp, "2%d") : number_format($_tmp, "2%d")); ?>
</td>
						
					</tr>
					<?php endforeach; endif; unset($_from); ?>
					<?php else: ?>
						<tr><td colspan="14" align="center"><h2>No data found ...</h2></td></tr>
					<?php endif; ?>
</table>
<script language="javascript">
<?php echo '
	function openReason(id){
		if(document.getElementById(\'reject[\'+id+\']\').value > 0  ) {
			if(document.getElementById(\'fisherman[\'+id+\']\').value == 0) {
				var qty = document.getElementById(\'reject[\'+id+\']\').value;
				doajaxAction(\'/account/selectReason/qty/\'+qty+\'/id/\'+id,0,\'reason\');
				popup(\'reason\');
			} else {
				alert(\'not allowed to put reason here ...\');
			}
		} else {
			alert(\'Please put reject quantity\');
		}
	}

	function saveors() {
		continuex = 0;
	'; ?>

		<?php $_from = $this->_tpl_vars['podetails']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['podetail']):
?>
	<?php echo '
			if (document.getElementById(\'reject[\'+ '; ?>
 <?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
 <?php echo ' +\']\').value == document.getElementById(\'reasonqty[\'+ '; ?>
 <?php echo $this->_tpl_vars['podetail']['po_detail_id']; ?>
  <?php echo ' +\']\').value ) {
				continuex = 1;
			}
	'; ?>

		<?php endforeach; endif; unset($_from); ?>
	<?php echo '
		if(continuex) {
			doajaxAction(\'/account/saveors\',1,\'main_content\',document.getElementById(\'mainForm\'));
		} else {
			alert(\'please provide reason for the reject qty\');
		}
	}
	
	function openFisherman(podetailid){
		doajaxAction("/account/orsfishermanlist/supplier_org_id/'; ?>
<?php echo $this->_tpl_vars['supplier_org_id']; ?>
<?php echo '/podetailid/"+podetailid,0,\'divfisherman\');
		popup(\'divfisherman\');
	}
'; ?>

</script>